<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">按钮</button>
    <hr>
    <button id="btn2">按钮2</button>
    <hr>
    <button id="btn3">按钮3</button>
    <hr>
    <button id="btn4">删除</button>

    <script>
        document.write("我是直接输出的内容")

        document.getElementById("btn").onclick=function(){
            alert("今天的天气好吗？")
        }
        document.getElementById("btn2").onclick=function(){
            console.log("明天可能会下雨！")
        }
        document.getElementById("btn3").onclick=function(){
            document.write("后天又是一个大晴天！")
        }
        document.getElementById("btn4").onclick=function(){
            // 定义一个变量保存方法的返回值
            var IsorNo =  confirm("你真的要删除吗？");
            console.log(IsorNo);
        }
    </script>
</body>
</html>